from rest_framework import serializers

from apps.interface.models import Interface


class InterfaceSerializers(serializers.ModelSerializer):
    project_name = serializers.CharField(source='project.name', read_only=True)

    class Meta:
        model = Interface
        fields = ['id', 'name', 'url', 'method', 'project_name', 'project', 'params', 'headers', 'response_headers', 'response_params']


class InterfaceListSerializers(serializers.ModelSerializer):
    project_name = serializers.CharField(source='project.name', read_only=True)

    class Meta:
        model = Interface
        fields = ['id', 'name', 'url', 'method', 'project_name', 'add_time', 'edit_time']


